From c664d62c2fe94437492146907823a24428ade228 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sun, 4 Jan 2015 11:07:13 +0100 Subject: [PATCH] Tests: Add coverage for TW-1452 --- test/tw-1452.t | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 test/tw-1452.t diff --git a/test/tw-1452.t b/test/tw-1452.t new file mode 100755 index 000000000..f6d232960 --- /dev/null +++ b/test/tw-1452.t @@ -0,0 +1,43 @@ +#!/usr/bin/env python2.7 +# -*- coding: utf-8 -*- + +import json +import sys +import os +import unittest + +# Ensure python finds the local simpletap module +sys.path.append(os.path.dirname(os.path.abspath(__file__))) + +from basetest import Task, TestCase + +class Test1481(TestCase): + def setUp(self): + self.t = Task() + self.t(('add', 'task')) + self.task_uuid = json.loads(self.t(('1', 'export'))[1].strip())['uuid'] + + def test_get_task_by_uuid_with_prefix(self): + """Tries to filter task simply by it's uuid, using uuid: prefix.""" + + # Load task + output = self.t(('uuid:%s' % self.task_uuid, 'export'))[1] + + # Sanity check it is the correct one + self.assertEqual(json.loads(output.strip())['uuid'], self.task_uuid) + + def test_get_task_by_uuid_without_prefix(self): + """Tries to filter task simply by it's uuid, without using uuid: prefix.""" + + # Load task + output = self.t((self.task_uuid, 'export'))[1] + + # Sanity check it is the correct one + self.assertEqual(json.loads(output.strip())['uuid'], self.task_uuid) + + +if __name__ == "__main__": + from simpletap import TAPTestRunner + unittest.main(testRunner=TAPTestRunner()) + +# vim: ai sts=4 et sw=4