Пример #1
0
def test_has_curd(context):
    "It should be possible to find curds saved locally"

    # Given that I have a curd hash, a curd manager linked to a curdcache
    curd_id = '682f87d84c80d0a85c9179de681b3474906113b3'
    path = FIXTURE('project1', '.curds')
    settings = {'index-url': 'http://localhost:8000/simple'}
    manager = CurdManager(path, settings)
    curd = manager.new(
        manager.add([
            FIXTURE('project1', 'requirements.txt'),
            FIXTURE('project1', 'development.txt'),
        ]))

    # When I retrieve the unknown curd
    curd = manager.get(curd.uid)

    # Then I see that my curd was properly retrieved
    curd.should.be.a(Curd)
    curd.uid.should.equal(curd_id)
    curd.path.should.equal(os.path.join(path, curd_id))

    # mocking the created prop
    with patch('os.stat') as stat:
        stat.return_value.st_ctime = 1376943600
        curd.created.should.equal(datetime(2013, 8, 19, 16, 20))
Пример #2
0
def test_has_curd(context):
    "It should be possible to find curds saved locally"

    # Given that I have a curd hash, a curd manager linked to a curdcache
    curd_id = '682f87d84c80d0a85c9179de681b3474906113b3'
    path = FIXTURE('project1', '.curds')
    settings = {'index-url': 'http://localhost:8000/simple'}
    manager = CurdManager(path, settings)
    curd = manager.new(manager.add([
        FIXTURE('project1', 'requirements.txt'),
        FIXTURE('project1', 'development.txt'),
    ]))

    # When I retrieve the unknown curd
    curd = manager.get(curd.uid)

    # Then I see that my curd was properly retrieved
    curd.should.be.a(Curd)
    curd.uid.should.equal(curd_id)
    curd.path.should.equal(os.path.join(path, curd_id))

    # mocking the created prop
    with patch('os.stat') as stat:
        stat.return_value.st_ctime = 1376943600
        curd.created.should.equal(datetime(2013, 8, 19, 16, 20))
Пример #3
0
def test_no_curd(context):
    "CurdManager.get() should return None when it can't find a specific curd"

    # Given that I have an instance of a curd manager
    curd_manager = CurdManager(FIXTURE('project1', '.curds'))

    # When I try to get a curd I know that does not exist
    curd = curd_manager.get('I-know-you-dont-exist')

    # Then I see it returns None
    curd.should.be.none
Пример #4
0
def test_no_curd(context):
    "CurdManager.get() should return None when it can't find a specific curd"

    # Given that I have an instance of a curd manager
    curd_manager = CurdManager(FIXTURE('project1', '.curds'))

    # When I try to get a curd I know that does not exist
    curd = curd_manager.get('I-know-you-dont-exist')

    # Then I see it returns None
    curd.should.be.none