def setUp(self): """ shared vars that must be initialized prior to test :return: """ dispatch.Tracker.append( data=dispatch.Case(index=42, client="client", platform='pc', cr=False, system="AL-quam"))
def setUp(self): """ shared vars that must be initialized prior to test :return: """ dispatch.Tracker.append( data=dispatch.Case(index=64, client="PotatoClient", platform='ps', cr=False, system="Ki"))
def setUp(self): global output test_inputs ='{"meta":{"event":"rescueCreated"},"data":{"id":"8e861212-c990-4ff9-b8e7-3c09da4adfb7","type":"rescues","attributes":{"notes":"","outcome":null,"title":null,"firstLimpetId":null,"client":"jkacina","set_system":"PENCIL SECTOR BV-O A6-4","codeRed":false,"unidentifiedRats":[],"status":"open","platform":"pc","quotes":[{"author":"Mecha","message":"RATSIGNAL - CMDR jkacina - System: PENCIL SECTOR BV-O A6-4 - Platform: PC - O2: OK - Language: English (en-CA)","createdAt":"2017-10-16T17:11:08.216278","updatedAt":"2017-10-16T17:11:08.216262","lastAuthor":"Mecha"}],"data":{"langID":"en","status":{},"IRCNick":"jkacina","boardIndex":5,"markedForDeletion":{"marked":false,"reason":"None.","reporter":"Noone."}},"updatedAt":"2017-10-16T17:11:07.794Z","createdAt":"2017-10-16T17:11:07.794Z","deletedAt":null},"relationships":{"rats":{"data":null},"firstLimpet":{"data":null},"epics":{"data":null}},"links":{"self":"/rescues/8e861212-c990-4ff9-b8e7-3c09da4adfb7"}}}' output = api_daemon.Parser.parse(test_inputs) expected_results = [ dispatch.Case(client="jkacina", api_id="8e861212-c990-4ff9-b8e7-3c09da4adfb7", platform='pc', system="PENCIL SECTOR BV-O A6-4")]
def test_b_get_case(self): """ I needed to prefix this with A because its alphabetically loaded and other tests depend on it... generates a case, adds it to the database, and verifies it was generated correctly """ self.assertTrue(dispatch.Tracker.append(data=dispatch.Case(client="client", index=42, cr=False, platform='pc', system="ki"))) data = dispatch.Tracker.get_case(value=42) # data: dispatch.Case self.assertIsNotNone(data) self.assertEqual(data.client, "client") self.assertEqual(data.index, 42) self.assertEqual(data.platform, 'pc')
def test_case_generation(self): expected_client = "potatoBot" expected_platform = "ps" expected_system = "Droju CB-X d1-4" expected_cr = True expected_index = 43 case = dispatch.Case(client=expected_client, index=expected_index, cr=expected_cr, system=expected_system, platform=expected_platform) self.assertIsNotNone(case) self.assertEqual(case.client, expected_client) self.assertEqual(case.platform, expected_platform) self.assertEqual(case.system, expected_system) self.assertEqual(case.index, expected_index) self.assertEqual(case.cr, expected_cr)