def test_backend_registry_find_definitions():
    "creating builders should be as easy as declaring classes"
    assert that(Registry.total()).equals(0)

    class Builder1(Registry):
        name = "First"
        scheme = "builder1://"

    assert that(Registry.total()).equals(1)
    assert that(Registry.get("builder1://")).equals(Builder1)
Esempio n. 2
0
def test_backend_registry_find_definitions():
    "creating builders should be as easy as declaring classes"
    assert that(Registry.total()).equals(0)

    class Builder1(Registry):
        name = 'First'
        scheme = 'builder1://'

    assert that(Registry.total()).equals(1)
    assert that(Registry.get('builder1://')).equals(Builder1)
def test_the_backend_registry_should_be_easy_to_erase():
    u"the backend registry should be easy to erase"

    class Builder2(Registry):
        name = "Second"
        scheme = "builder2://"

    assert Registry.total() >= 1, "there should have one or more builders defined on the registry"

    Registry.clear()

    assert that(Registry.total()).equals(0)
Esempio n. 4
0
def test_the_backend_registry_should_be_easy_to_erase():
    u"the backend registry should be easy to erase"

    class Builder2(Registry):
        name = 'Second'
        scheme = 'builder2://'

    assert Registry.total() >= 1, \
        'there should have one or more builders defined on the registry'

    Registry.clear()

    assert that(Registry.total()).equals(0)
def test_object_should_do_something():
    u"Registry should be represented as choices for ChoiceFields"
    assert that("this").equals("this")

    class Builder1(Registry):
        name = "Git Builder"
        scheme = "builder1://"

    class Builder2(Registry):
        name = "Mercurial Builder"
        scheme = "builder2://"

    assert that(Registry.as_choices()).equals((("Git Builder", "builder1://"), ("Mercurial Builder", "builder2://")))
Esempio n. 6
0
def test_object_should_do_something():
    u"Registry should be represented as choices for ChoiceFields"
    assert that("this").equals("this")

    class Builder1(Registry):
        name = 'Git Builder'
        scheme = 'builder1://'

    class Builder2(Registry):
        name = 'Mercurial Builder'
        scheme = 'builder2://'

    assert that(Registry.as_choices()).equals((
        ('Git Builder', 'builder1://'),
        ('Mercurial Builder', 'builder2://'),
    ))
Esempio n. 7
0
class Project(models.Model):
    name = models.CharField(max_length=100)
    backend = models.CharField(max_length=100, choices=Registry.as_choices())
    created_at = models.DateTimeField(auto_now_add=True)
    last_changed = models.DateTimeField(null=True, blank=True)
    build_command = models.TextField()