# Path: djangolg/events.py
# EVENT_START = 0
# EVENT_QUERY_ACCEPT = 1
# EVENT_QUERY_REJECT = 2
# EVENT_QUERY_INVALID = 3
# EVENT_QUERY_FAILED = 4
# EVENT_QUERY_ERROR = 5
# EVENT_CHOICES = (
#     (EVENT_START, "Session Started"),
#     (EVENT_QUERY_ACCEPT, "Query Authorised"),
#     (EVENT_QUERY_REJECT, "Query Rejected"),
#     (EVENT_QUERY_INVALID, "Invalid Query"),
#     (EVENT_QUERY_FAILED, "Query Execution Failed"),
#     (EVENT_QUERY_ERROR, "Unhandled Error")
# )
# 
# Path: djangolg/models.py
# class Router(models.Model):
# class Location(models.Model):
# class Credential(models.Model):
# class Log(models.Model):
#     def label(self):
#     def __str__(self):
#     def __unicode__(self):
#     def __str__(self):
#     def __unicode__(self):
#     def __str__(self):
#     def __unicode__(self):
#     def __str__(self):
#     def __unicode__(self):
#     CRED_TYPE_PASSWD = 0
#     CRED_TYPE_PUBKEY = 1
#     CRED_TYPE_CHOICES = (
#         (CRED_TYPE_PASSWD, "Password"),
#         (CRED_TYPE_PUBKEY, "Public Key"),
#     )


from django.test import TestCase
from djangolg import events, models
            name="test-location", sitecode="test01"
        )
        router = models.Router.objects.create(
            hostname="test-router", dialect="ios",
            location=location, credentials=credentials
        )
        models.Log.objects.create(
            event=events.EVENT_START,
            src_host="::1", router=router,
            error="test-log-error"
        )

    def test_credentials(self):
        """Test getting credentials by name and returning properties."""
        credentials = models.Credential.objects.get(name="test-credentials")
        assert "{}".format(credentials) == "test-credentials"

    def test_location(self):
        """Test getting location by name and returning properties."""
        location = models.Location.objects.get(name="test-location")
        assert "{}".format(location) == "test01"

    def test_router(self):
        """Test getting router by name and returning properties."""
        router = models.Router.objects.get(hostname="test-router")
        assert "{}".format(router) == "test-router"
        assert router.label == "test-location"

    def test_log(self):
        """Test getting log entry by (event, error) pair."""

# Path: djangolg/events.py
# EVENT_START = 0
# EVENT_QUERY_ACCEPT = 1
# EVENT_QUERY_REJECT = 2
# EVENT_QUERY_INVALID = 3
# EVENT_QUERY_FAILED = 4
# EVENT_QUERY_ERROR = 5
# EVENT_CHOICES = (
#     (EVENT_START, "Session Started"),
#     (EVENT_QUERY_ACCEPT, "Query Authorised"),
#     (EVENT_QUERY_REJECT, "Query Rejected"),
#     (EVENT_QUERY_INVALID, "Invalid Query"),
#     (EVENT_QUERY_FAILED, "Query Execution Failed"),
#     (EVENT_QUERY_ERROR, "Unhandled Error")
# )
# 
# Path: djangolg/models.py
# class Router(models.Model):
# class Location(models.Model):
# class Credential(models.Model):
# class Log(models.Model):
#     def label(self):
#     def __str__(self):
#     def __unicode__(self):
#     def __str__(self):
#     def __unicode__(self):
#     def __str__(self):
#     def __unicode__(self):
#     def __str__(self):
#     def __unicode__(self):
#     CRED_TYPE_PASSWD = 0
#     CRED_TYPE_PUBKEY = 1
#     CRED_TYPE_CHOICES = (
#         (CRED_TYPE_PASSWD, "Password"),
#         (CRED_TYPE_PUBKEY, "Public Key"),
#     )


# Path: tests/test_models.py
from django.test import TestCase
from djangolg import events, models

            name="test-location", sitecode="test01"
        )
        router = models.Router.objects.create(
            hostname="test-router", dialect="ios",
            location=location, credentials=credentials
        )
        models.Log.objects.create(
            event=events.EVENT_START,
            src_host="::1", router=router,
            error="test-log-error"
        )

    def test_credentials(self):
        """Test getting credentials by name and returning properties."""
        credentials = models.Credential.objects.get(name="test-credentials")
        assert "{}".format(credentials) == "test-credentials"

    def test_location(self):
        """Test getting location by name and returning properties."""
        location = models.Location.objects.get(name="test-location")
        assert "{}".format(location) == "test01"

    def test_router(self):
        """Test getting router by name and returning properties."""
        router = models.Router.objects.get(hostname="test-router")
        assert "{}".format(router) == "test-router"
        assert router.label == "test-location"

    def test_log(self):
        """Test getting log entry by (event, error) pair."""

        log = models.Log.objects.get(event=events.EVENT_START,