GithubHelp home page GithubHelp logo

dpb1 / charm-fixtures Goto Github PK

View Code? Open in Web Editor NEW

This project forked from freeekanayaka/charm-test

0.0 1.0 0.0 37 KB

A Python fixture for creating fake juju hook tools, intended for charm unit testing.

License: Other

Python 100.00%

charm-fixtures's Introduction

Overview

Build Status

Python fixtures for faking out the boundaries of a Juju charm and allow convenient unit-testing.

The boundaries are typically executables (e.g. Juju hook tools), network and file system.

Example

The CharmTest base class sets up all available charm fixtures, so you can for example programmatically modify backend juju data that hook tools will return, create fake system users or groups, etc.

from charmfixtures import CharmTest

from charmhelpers.core import hookenv


class MyCharmTest(CharmTest):

    def test_log(self):
        """Inspect log lines emitted by your charm code."""
        hookenv.log("Hello world!")
        self.assertEqual("INFO: Hello world!", self.unit.log[0])

    def test_config(self):
        """Set config values for your charm code."""
        self.application.config["foo"] = "bar"
        self.assertEqual("bar", hookenv.config()["foo"])

charm-fixtures's People

Contributors

dpb1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.