Exemple #1
0
def test_hash_story_line(patch, story):
    patch.object(hashlib, 'sha1')
    story.name = 'story_name'
    ret = Containers.hash_story_line(story, {'ln': '1'})

    hashlib.sha1.assert_called_with('story_name-1'.encode('utf-8'))
    assert ret == hashlib.sha1().hexdigest()
Exemple #2
0
def test_get_container_name(patch, story, line, reusable):
    patch.object(Containers, 'is_service_reusable', return_value=reusable)
    story.app.app_id = 'my_app'
    ret = Containers.get_container_name(story, line, 'alpine')
    if reusable:
        assert ret == 'asyncy--my_app-alpine-1'
    else:
        h = Containers.hash_story_line(story, line)
        assert ret == f'asyncy--{story.app.app_id}-{h}-1'