def test_generate_file_name_invalid_artefact(self):
        artefact = dict()

        project = dict()
        project[GreenHouseWebhook.PayloadKey.Name] = 'test_app'

        dt = datetime.datetime(2015, month=11, day=21, hour=17, minute=10, second=5)
        webhook = GreenHouseWebhook()
        file_name = webhook.generate_file_name(project, artefact, dt)

        self.assertIsNone(file_name)
    def test_generate_file_name(self):
        artefact = dict()
        artefact[GreenHouseWebhook.PayloadKey.Type] = GreenHouseWebhook.Artefact.Apk
        artefact[GreenHouseWebhook.PayloadKey.Filename] = 'test_file'

        project = dict()
        project[GreenHouseWebhook.PayloadKey.Name] = 'test_app'

        dt = datetime.datetime(2015, month=11, day=21, hour=17, minute=10, second=5)
        webhook = GreenHouseWebhook()
        file_name = webhook.generate_file_name(project, artefact, dt)

        self.assertEqual('test_app_2015-11-21_17:10:05.apk', file_name)
    def test_find_artefact_invalid_payload(self):
        webhook = GreenHouseWebhook()
        payload = dict()

        self.assertIsNone(webhook.find_artefact(payload, artefact_type=GreenHouseWebhook.Artefact.Apk))
    def test_find_artefact_invalid_type(self):
        webhook = GreenHouseWebhook()
        payload = self.generate_payload_with_artefact()
        artefact = webhook.find_artefact(payload, artefact_type=GreenHouseWebhook.Artefact.Ipa)

        self.assertIsNone(artefact)